<template>
  <div class="home-banner" v-if="banners.status === 'success'">
    <XtxCarousel :count="banners.result.length">
      <template
        v-for="(item, index) in banners.result"
        v-slot:[`default-${index}`]
      >
        <RouterLink :to="item.hrefUrl">
          <img :src="item.imgUrl" :alt="item.id" />
        </RouterLink>
      </template>
    </XtxCarousel>
  </div>
</template>
<script lang="ts" setup>
import { useHomeStore } from "@/stores/brandStore";

const homeStore = useHomeStore();
const { banners } = storeToRefs(homeStore);
const { getBanners } = homeStore;
getBanners();
</script>
<style scoped lang="less">
.home-banner {
  width: 1240px;
  height: 500px;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 98;
  .xtx-carousel {
    :deep(.carousel-btn.prev) {
      left: 270px;
    }
    :deep(.carousel-indicator) {
      padding-left: 250px;
    }
  }
}
</style>
